﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional

namespace PlatformUW.EntityFramework.Migrations
{
    /// <inheritdoc />
    public partial class cm3 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DeleteData(
                table: "Characters",
                keyColumn: "Id",
                keyValue: new Guid("372a0556-862c-45b6-aecd-cbe48ae45960"));

            migrationBuilder.DeleteData(
                table: "Characters",
                keyColumn: "Id",
                keyValue: new Guid("41f58b4d-a73c-400e-b812-aa7b527bb506"));

            migrationBuilder.DeleteData(
                table: "Characters",
                keyColumn: "Id",
                keyValue: new Guid("47261fef-788d-461a-8b52-4c9bb9128fef"));

            migrationBuilder.DeleteData(
                table: "Characters",
                keyColumn: "Id",
                keyValue: new Guid("5838bee1-7b4d-4317-a918-1e2faa7408a0"));

            migrationBuilder.DeleteData(
                table: "Characters",
                keyColumn: "Id",
                keyValue: new Guid("bfe68639-38e4-42c2-9432-490c41994db4"));

            migrationBuilder.DeleteData(
                table: "Sensors",
                keyColumn: "Id",
                keyValue: new Guid("03335e02-a170-4de3-9ce4-767a90ae7cab"));

            migrationBuilder.DeleteData(
                table: "Sensors",
                keyColumn: "Id",
                keyValue: new Guid("33587450-d724-48ee-aa52-b6e48ead29bd"));

            migrationBuilder.DeleteData(
                table: "Sensors",
                keyColumn: "Id",
                keyValue: new Guid("77cd269e-efa2-4c35-b62d-4f262d9c1b34"));

            migrationBuilder.DeleteData(
                table: "Sensors",
                keyColumn: "Id",
                keyValue: new Guid("c5ea5f48-5f0d-4fa7-9d8c-813949f3a124"));

            migrationBuilder.DeleteData(
                table: "Players",
                keyColumn: "Id",
                keyValue: new Guid("197d9733-480f-4650-a175-300e8bf583b6"));

            migrationBuilder.DeleteData(
                table: "Players",
                keyColumn: "Id",
                keyValue: new Guid("f0824385-276f-4809-9236-b41810e7c590"));

            migrationBuilder.AlterColumn<bool>(
                name: "optSupport21Cmd",
                table: "Sensors",
                type: "tinyint(1)",
                nullable: false,
                defaultValue: true,
                oldClrType: typeof(bool),
                oldType: "tinyint(1)");

            migrationBuilder.AlterColumn<bool>(
                name: "optSplit3_4Cmd",
                table: "Sensors",
                type: "tinyint(1)",
                nullable: false,
                defaultValue: true,
                oldClrType: typeof(bool),
                oldType: "tinyint(1)");

            migrationBuilder.AlterColumn<string>(
                name: "SerialParams",
                table: "Sensors",
                type: "longtext",
                nullable: true,
                defaultValue: "N-8-1",
                oldClrType: typeof(string),
                oldType: "longtext",
                oldNullable: true)
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn<int>(
                name: "PortCategory",
                table: "Sensors",
                type: "int",
                nullable: false,
                defaultValue: 0,
                oldClrType: typeof(int),
                oldType: "int");

            migrationBuilder.AlterColumn<string>(
                name: "Name",
                table: "Sensors",
                type: "varchar(20)",
                maxLength: 20,
                nullable: false,
                oldClrType: typeof(string),
                oldType: "longtext")
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn<string>(
                name: "Ip",
                table: "Sensors",
                type: "longtext",
                nullable: false,
                defaultValue: "127.0.0.1",
                oldClrType: typeof(string),
                oldType: "longtext")
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn<string>(
                name: "Description",
                table: "Sensors",
                type: "varchar(100)",
                maxLength: 100,
                nullable: false,
                oldClrType: typeof(string),
                oldType: "longtext")
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<DateTime>(
                name: "DateCreated",
                table: "Sensors",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.InsertData(
                table: "Players",
                columns: new[] { "Id", "Account", "AccountType", "DateCreated" },
                values: new object[,]
                {
                    { new Guid("75d91e31-4a57-4cb5-8067-d558c101c2fb"), "ZhangSan", "Free", new DateTime(2025, 6, 8, 15, 9, 39, 831, DateTimeKind.Local).AddTicks(2395) },
                    { new Guid("a296bafb-96cf-43a5-ba43-ff5b7f067f0c"), "LiShi", "Free", new DateTime(2025, 6, 8, 15, 9, 39, 831, DateTimeKind.Local).AddTicks(2406) }
                });

            migrationBuilder.InsertData(
                table: "Sensors",
                columns: new[] { "Id", "Baudrate", "COMn", "DateCreated", "Description", "Enabled", "Interval", "Ip", "Name", "Port", "Protocol", "RO_Address", "RO_Length", "RW_Address", "RW_Length", "Station", "localIp", "localPort" },
                values: new object[,]
                {
                    { new Guid("38343269-dc65-4d68-8951-f7893327d0e6"), 0, null, new DateTime(2025, 6, 8, 15, 9, 39, 831, DateTimeKind.Local).AddTicks(4031), "Alitute Sensor", true, 0, "192.168.1.100", "Alitute", 5001, 0, 1, 10, 100, 10, 1, null, 0 },
                    { new Guid("67cd34f2-8709-4773-a12d-2d475d4aef1a"), 0, null, new DateTime(2025, 6, 8, 15, 9, 39, 831, DateTimeKind.Local).AddTicks(4035), "Depth Sensor", true, 0, "192.168.1.101", "Depth", 5001, 3, 1, 10, 0, 0, 1, null, 0 },
                    { new Guid("d63c4c83-a6bd-4e86-b88f-68ddbadd84bf"), 0, null, new DateTime(2025, 6, 8, 15, 9, 39, 831, DateTimeKind.Local).AddTicks(3964), "Temperature Sensor", true, 0, "192.168.1.100", "Temperature", 5000, 0, 1, 10, 100, 10, 1, null, 0 },
                    { new Guid("f1c0f9bc-0bf1-4a39-8899-6dd07b30118f"), 0, null, new DateTime(2025, 6, 8, 15, 9, 39, 831, DateTimeKind.Local).AddTicks(4029), "Humidity Sensor", true, 0, "192.168.1.100", "Humidity", 5000, 0, 1, 10, 100, 10, 2, null, 0 }
                });

            migrationBuilder.InsertData(
                table: "Characters",
                columns: new[] { "Id", "Classes", "DateCreated", "Level", "NickName", "PlayerId" },
                values: new object[,]
                {
                    { new Guid("447e2408-3676-46f2-a9dd-9a6581293253"), "Death Knight", new DateTime(2025, 6, 8, 15, 9, 39, 831, DateTimeKind.Local).AddTicks(3136), 90, "Batman", new Guid("a296bafb-96cf-43a5-ba43-ff5b7f067f0c") },
                    { new Guid("44986498-b6e3-4a41-8b40-79a87a586f7a"), "Warrior", new DateTime(2025, 6, 8, 15, 9, 39, 831, DateTimeKind.Local).AddTicks(3133), 90, "Iron Man", new Guid("75d91e31-4a57-4cb5-8067-d558c101c2fb") },
                    { new Guid("80c4d1c4-b482-4eed-8c5b-d85ba0630533"), "Palain", new DateTime(2025, 6, 8, 15, 9, 39, 831, DateTimeKind.Local).AddTicks(3137), 99, "Superman", new Guid("a296bafb-96cf-43a5-ba43-ff5b7f067f0c") },
                    { new Guid("8aba6c37-6def-4154-8c9d-93ebae3236ab"), "Druid", new DateTime(2025, 6, 8, 15, 9, 39, 831, DateTimeKind.Local).AddTicks(3134), 80, "Spider Man", new Guid("75d91e31-4a57-4cb5-8067-d558c101c2fb") },
                    { new Guid("da805eaf-edff-48be-84ed-9ea8678e046e"), "Mage", new DateTime(2025, 6, 8, 15, 9, 39, 831, DateTimeKind.Local).AddTicks(3130), 99, "Code Man", new Guid("75d91e31-4a57-4cb5-8067-d558c101c2fb") }
                });

            migrationBuilder.CreateIndex(
                name: "IX_Sensors_Name",
                table: "Sensors",
                column: "Name",
                unique: true);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "IX_Sensors_Name",
                table: "Sensors");

            migrationBuilder.DeleteData(
                table: "Characters",
                keyColumn: "Id",
                keyValue: new Guid("447e2408-3676-46f2-a9dd-9a6581293253"));

            migrationBuilder.DeleteData(
                table: "Characters",
                keyColumn: "Id",
                keyValue: new Guid("44986498-b6e3-4a41-8b40-79a87a586f7a"));

            migrationBuilder.DeleteData(
                table: "Characters",
                keyColumn: "Id",
                keyValue: new Guid("80c4d1c4-b482-4eed-8c5b-d85ba0630533"));

            migrationBuilder.DeleteData(
                table: "Characters",
                keyColumn: "Id",
                keyValue: new Guid("8aba6c37-6def-4154-8c9d-93ebae3236ab"));

            migrationBuilder.DeleteData(
                table: "Characters",
                keyColumn: "Id",
                keyValue: new Guid("da805eaf-edff-48be-84ed-9ea8678e046e"));

            migrationBuilder.DeleteData(
                table: "Sensors",
                keyColumn: "Id",
                keyValue: new Guid("38343269-dc65-4d68-8951-f7893327d0e6"));

            migrationBuilder.DeleteData(
                table: "Sensors",
                keyColumn: "Id",
                keyValue: new Guid("67cd34f2-8709-4773-a12d-2d475d4aef1a"));

            migrationBuilder.DeleteData(
                table: "Sensors",
                keyColumn: "Id",
                keyValue: new Guid("d63c4c83-a6bd-4e86-b88f-68ddbadd84bf"));

            migrationBuilder.DeleteData(
                table: "Sensors",
                keyColumn: "Id",
                keyValue: new Guid("f1c0f9bc-0bf1-4a39-8899-6dd07b30118f"));

            migrationBuilder.DeleteData(
                table: "Players",
                keyColumn: "Id",
                keyValue: new Guid("75d91e31-4a57-4cb5-8067-d558c101c2fb"));

            migrationBuilder.DeleteData(
                table: "Players",
                keyColumn: "Id",
                keyValue: new Guid("a296bafb-96cf-43a5-ba43-ff5b7f067f0c"));

            migrationBuilder.DropColumn(
                name: "DateCreated",
                table: "Sensors");

            migrationBuilder.AlterColumn<bool>(
                name: "optSupport21Cmd",
                table: "Sensors",
                type: "tinyint(1)",
                nullable: false,
                oldClrType: typeof(bool),
                oldType: "tinyint(1)",
                oldDefaultValue: true);

            migrationBuilder.AlterColumn<bool>(
                name: "optSplit3_4Cmd",
                table: "Sensors",
                type: "tinyint(1)",
                nullable: false,
                oldClrType: typeof(bool),
                oldType: "tinyint(1)",
                oldDefaultValue: true);

            migrationBuilder.AlterColumn<string>(
                name: "SerialParams",
                table: "Sensors",
                type: "longtext",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "longtext",
                oldNullable: true,
                oldDefaultValue: "N-8-1")
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn<int>(
                name: "PortCategory",
                table: "Sensors",
                type: "int",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "int",
                oldDefaultValue: 0);

            migrationBuilder.AlterColumn<string>(
                name: "Name",
                table: "Sensors",
                type: "longtext",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "varchar(20)",
                oldMaxLength: 20)
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn<string>(
                name: "Ip",
                table: "Sensors",
                type: "longtext",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "longtext",
                oldDefaultValue: "127.0.0.1")
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn<string>(
                name: "Description",
                table: "Sensors",
                type: "longtext",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "varchar(100)",
                oldMaxLength: 100)
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.InsertData(
                table: "Players",
                columns: new[] { "Id", "Account", "AccountType", "DateCreated" },
                values: new object[,]
                {
                    { new Guid("197d9733-480f-4650-a175-300e8bf583b6"), "LiShi", "Free", new DateTime(2025, 6, 8, 14, 27, 14, 416, DateTimeKind.Local).AddTicks(2188) },
                    { new Guid("f0824385-276f-4809-9236-b41810e7c590"), "ZhangSan", "Free", new DateTime(2025, 6, 8, 14, 27, 14, 416, DateTimeKind.Local).AddTicks(2176) }
                });

            migrationBuilder.InsertData(
                table: "Sensors",
                columns: new[] { "Id", "Baudrate", "COMn", "Description", "Enabled", "Interval", "Ip", "Name", "Port", "PortCategory", "Protocol", "RO_Address", "RO_Length", "RW_Address", "RW_Length", "SerialParams", "Station", "localIp", "localPort", "optSplit3_4Cmd", "optSupport21Cmd" },
                values: new object[,]
                {
                    { new Guid("03335e02-a170-4de3-9ce4-767a90ae7cab"), 0, null, "Temperature Sensor", true, 0, "192.168.1.100", "Temperature", 5000, 0, 0, 1, 10, 100, 10, null, 1, null, 0, false, false },
                    { new Guid("33587450-d724-48ee-aa52-b6e48ead29bd"), 0, null, "Depth Sensor", true, 0, "192.168.1.101", "Depth", 5001, 0, 3, 1, 10, 0, 0, null, 1, null, 0, false, false },
                    { new Guid("77cd269e-efa2-4c35-b62d-4f262d9c1b34"), 0, null, "Humidity Sensor", true, 0, "192.168.1.100", "Humidity", 5000, 0, 0, 1, 10, 100, 10, null, 2, null, 0, false, false },
                    { new Guid("c5ea5f48-5f0d-4fa7-9d8c-813949f3a124"), 0, null, "Alitute Sensor", true, 0, "192.168.1.100", "Alitute", 5001, 0, 0, 1, 10, 100, 10, null, 1, null, 0, false, false }
                });

            migrationBuilder.InsertData(
                table: "Characters",
                columns: new[] { "Id", "Classes", "DateCreated", "Level", "NickName", "PlayerId" },
                values: new object[,]
                {
                    { new Guid("372a0556-862c-45b6-aecd-cbe48ae45960"), "Palain", new DateTime(2025, 6, 8, 14, 27, 14, 416, DateTimeKind.Local).AddTicks(2860), 99, "Superman", new Guid("197d9733-480f-4650-a175-300e8bf583b6") },
                    { new Guid("41f58b4d-a73c-400e-b812-aa7b527bb506"), "Warrior", new DateTime(2025, 6, 8, 14, 27, 14, 416, DateTimeKind.Local).AddTicks(2855), 90, "Iron Man", new Guid("f0824385-276f-4809-9236-b41810e7c590") },
                    { new Guid("47261fef-788d-461a-8b52-4c9bb9128fef"), "Mage", new DateTime(2025, 6, 8, 14, 27, 14, 416, DateTimeKind.Local).AddTicks(2846), 99, "Code Man", new Guid("f0824385-276f-4809-9236-b41810e7c590") },
                    { new Guid("5838bee1-7b4d-4317-a918-1e2faa7408a0"), "Druid", new DateTime(2025, 6, 8, 14, 27, 14, 416, DateTimeKind.Local).AddTicks(2857), 80, "Spider Man", new Guid("f0824385-276f-4809-9236-b41810e7c590") },
                    { new Guid("bfe68639-38e4-42c2-9432-490c41994db4"), "Death Knight", new DateTime(2025, 6, 8, 14, 27, 14, 416, DateTimeKind.Local).AddTicks(2858), 90, "Batman", new Guid("197d9733-480f-4650-a175-300e8bf583b6") }
                });
        }
    }
}
